<?php
namespace app\api\model\order;
use think\facade\Db;

class DistributionOrder{
	
	public function findOrderData($_where,$_field)
	{
		return Db::name("order_opus")->alias("o")
				->join("opus opus","opus.id=o.opus_id")
				->join("opus_number n","n.id=o.opus_number_id")
				->join("user u","u.id=o.buyer_id")
				->leftJoin("user uu","uu.id=o.member_uid")
				->where($_where)
				->field($_field)
				->find();
	}
	
	public function selectOrderData($_where,$_field,$_limit,$_order)
	{
		$_data=Db::name("order_opus")->alias("o")
				->join("opus opus","opus.id=o.opus_id")
				->join("opus_number n","n.id=o.opus_number_id")
				->join("user u","u.id=o.buyer_id")
				->leftJoin("user uu","uu.id=o.member_uid")
				->where($_where)
				->field($_field)
				->limit(current($_limit),end($_limit))
				->order($_order)
				->select();
		return !empty($_data)?$_data->toArray():[];		
	}
	
	
}
?>